import { meta } from '@turf/turf'
import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
 
  {
    path: '/',
    redirect: '/Home',
  },
  {
    path: '/Home',
    name: 'Home',
    // query: {
    //   id: '123',
    //   title: '消息001',
    // },
    meta: {
      keepAlive: true, 
    },
    component: () => import('../page/newHome.vue'),
 
  },
  {
    path: '/liveData',
    name: 'liveData',
    component: () => import('../page/liveData.vue'),
    meta: {
      keepAlive: false,
    },
  },
  {
    path: '/earlyWarning',
    name: 'earlyWarning',
    component: () => import('../page/earlyWarning.vue'),
    meta: {
      keepAlive: false,
    },
  },
  {
    path: '/pdf',
    name: 'pdf',
    component: () => import('../components/pdf/index.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/wangge',
    name: 'wangge',
    component: () => import('../components/liveData/geoPosition.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/FC',
    name: 'FC',
    component: () => import('../page/FC.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/disasterWarning',
    name: 'disasterWarning',
    component: () => import('../page/disasterWarning.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/dwWarnEarth',
    name: 'dwWarnEarth',
    component: () => import('../page/dwWarnEarth.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../page/login.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
      requiresAuth: true, // 标识需要登录才能访问的路由
    },
  },

  {
    path: '/message',
    name: 'message',
    component: () => import('../page/message.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },


  {
    path: '/staLiveData',
    name: 'staLiveData',
    component: () => import('../page/staLiveData.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/staCompre',
    name: 'staCompre',
    component: () => import('../page/staCompre.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/staDisaster',
    name: 'staDisaster',
    component: () => import('../page/staDisaster.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/staDisasterList',
    name: 'staDisasterList',
    component: () => import('../page/staDisasterList.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },

  {
    path: '/historyData',
    name: 'historyData',
    component: () => import('../page/historyData.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },

  {
    path: '/earlyWarnHistory',
    name: 'earlyWarnHistory',
    component: () => import('../page/earlyWarnHistory.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/regionalManagement',
    name: 'regionalManagement',
    component: () => import('../page/regionalManagement.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },

  {
    path: '/decision',
    name: 'decision',
    component: () => import('../page/decision.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/rongzai',
    name: 'rongzai',
    component: () => import('../page/disastersituation.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/Earlywarningstatistics',
    name: 'Earlywarningstatistics',
    component: () => import('../page/Earlywarningstatistics.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/Disastersituationlist',
    name: 'Disastersituationlist',
    component: () => import('../page/Disastersituationlist.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/weather',
    name: 'weather',
    component: () => import('../page/weather.vue'),
    meta: {
      keepAlive: false, // 不需要缓存
    },
  },
  {
    path: '/power',
    name: 'power',
    component: () => import('../page/power.vue'),
    meta: {
      keepAlive: false,
    },
  },
  {
    path: '/Windparticles',
    name: 'Windparticles',
    component: () => import('../page/Windparticles.vue'),
    meta: {
      keepAlive: false,
    },
  },
]

const router = new VueRouter({
  routes,
})

router.beforeEach((to, from, next) => {
  window.scrollTo(0, 0)
  next()
})

export default router
